<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8" import="common.*,Dao.*,vo.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title></title>
</head>
<body>
<%
request.setCharacterEncoding("utf-8");
String email = request.getParameter("email");
String pass = request.getParameter("pass");
Md5 md = new Md5();
String pass2 = md.getMD5(pass);
Userdao dao = new Userdao();
boolean result = dao.isLogin(email, pass2);
if(result){
	User user = dao.getUserByUname(email);
	session.setAttribute("user", user);
	String counter =(String)application.getAttribute("counter");//取当前在线人数
	int count;//在线人数
	//取当前在线人数
	if(counter==null){
		//第一个上线
		count=0;//第一个人上线
	}else{
		count=Integer.parseInt(counter);
	}
	//2-更新在线人数(存)
	count++;
	application.setAttribute("counter", String.valueOf(count));//把最新得在线人数保存到application中
	%>
	<script type="text/javascript">
	window.location.href="../shixun/Zhuye.jsp";
	</script>
	<%
}else{
	%>
	<script type="text/javascript">
	window.alert("登录失败，请检查邮箱及密码！");
	window.location.href="Login.jsp";
	</script>
	<%
}

%>
</body>
</html>